package world.square;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.math.BigDecimal;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import world.edges.Border;
import world.edges.Door;
import world.edges.Wall;
import world.placement.Direction;

public class RockTest {
		private static Rock rockSquare;

		@BeforeClass
		public static void setUpBeforeClass() throws Exception {
			rockSquare = new Rock();
		}
		
		@Before
		public void setUp() throws Exception { 

		}
		
		@Test
		public final void canHaveAsBorder_Cases(){
			assertTrue(rockSquare.canHaveAsBorder(new Border(new Wall(false),Direction.NORTH)));
			assertFalse(rockSquare.canHaveAsBorder(new Border(new Door(false),Direction.NORTH)));
			assertFalse(rockSquare.canHaveAsBorder(null));
		}

		@Test
		public final void hasProperBorders_SingleCase(){
			assertTrue(rockSquare.hasProperBorders());
		}
		
		@Test
		public final void isValidHumidity_FalseCase(){
			assertFalse(Rock.isValidHumidity(new BigDecimal("12.05")));
		}

		@Test
		public final void isValidHumidity_TrueCase(){
			assertTrue(Rock.isValidHumidity(new BigDecimal("0")));
			assertTrue(Rock.isValidHumidity(rockSquare.getHumidity()));
		}
		@Test
		public final void canRemoveBorderInDirection_SingleCase(){
			assertFalse(rockSquare.canRemoveBorderInDirection(Direction.NORTH));
		}
}
